{% import "components/user.html" as user with context %}
{% import "components/contest.html" as contest with context %}
<tbody data-fragment-id="constest_balloon-tbody">
  {%- for bdoc in bdocs -%}
  <tr data-bid="{{ bdoc.bid }}">
    {% if bdoc.sent %}
      <td class="col--status record-status--border pass">
        <span class="icon record-status--icon pass"></span>
        <span class="record-status--text pass">{{ _('Sent') }}</span>
      </td>
    {% else %}
      <td class="col--status record-status--border pending">
        <span class="icon record-status--icon pending"></span>
        <span class="record-status--text pending">{{ _('Waiting') }}</span>
      </td>
    {% endif %}
    <td class="col--bid">{{ bdoc._id.toHexString()|truncate(8,true,'') }}</td>
    <td class="col--problem col--problem-name" style="color:{{ tdoc.balloon[bdoc.pid].color }}">
      {% if not bdoc.sent %}
        <form class="form--inline" method="post">
          <input type="hidden" name="balloon" value="{{ bdoc._id.toHexString() }}">
          <button type="submit" name="operation" value="done" class="link text-maroon lighter" data-balloon="{{ bdoc._id.toHexString() }}">
            <span class="icon icon-send"></span>
            {{ _('Send') }}
          </button> 
        </form>
      {% endif %}
      <b>{{ utils.getAlphabeticId(tdoc.pids.indexOf(bdoc.pid)) }}</b>&nbsp;&nbsp;({{ tdoc.balloon[bdoc.pid].name }})
    </td>
    <td class="col--submit-by" data-tooltip="{{ bdoc._id.getTimestamp().format() }}">{{ user.render_inline(udict[bdoc.uid], badge=false) }}</td>
    <td class="col--send-by"{% if bdoc.sent %} data-tooltip="{{ bdoc.sentAt.format() }}"{% endif %}>
      {% if bdoc.sent %}{{ user.render_inline(udict[bdoc.sent], avatar=false, badge=false) }}{% else %}-{% endif %}
    </td>
    <td class="col--awards">{% if bdoc.first %}{{ _('First of Problem') }}{% endif %}</td>
  </tr>
  {%- endfor -%}
</tbody>